import type { FC } from 'react';
import style from './index.less';
import React, { Fragment, useState, useEffect } from 'react';
import IconFont from '@/components/Icon';
import { givePraiseArticle,getCollectList } from './service';
interface Props {}
const Achievement: FC<Props> = () => {

  const [article, setArticle] = useState();
  const [collect, setCollect] = useState();
  const getArticle = () => {
    givePraiseArticle({operateuser_id: localStorage.getItem('user_id') }).then(res => {
      setArticle(res.data.length);
    });
  };
  const getCollect = () => {
    getCollectList({ operateuser_id: localStorage.getItem('user_id') }).then(res => {
      setCollect(res.data.length);
    });
  };
  
  useEffect(() => {
    getArticle();
    getCollect();
  }, []);
  return (
  <div className={style.count_con}>
    <div className={style.left}>
      <div className={style.title}>点赞了</div>
      <div className={style.count}>{article}</div>
    </div>
    <div className={style.right}>
      <div className={style.title}>收藏了</div>
      <div className={style.count}>{collect}</div>
    </div>
  </div>
  );
};

export default Achievement;
 